var assert = require('assert');
var should = require('should');
var util = require('util');
var zlib = require('zlib');
var _ = require('lodash');
var unionTaskHandler = require('../../../app/servers/union/handler/unionTaskHandler.js');
var config = require('../../config');
var configUtil = require('../../../app/util/configUtil');
var analyze = require('kc-analyze');

suite('联盟任务测试', function () {
    setup(function (done) {
        var analyze_config = configUtil.load('analyze');
        var game_config = configUtil.load('game');
        analyze.initialize({
            host: analyze_config.host,
            server_id: game_config.server_id
        });
        done();
    });

    suite('联盟任务开始', function () {
        test('联盟任务开始', function (done) {
            var msg = {};
            msg.task_id = config.union_task_id;
            var session = {};
            session.uid = config.role_id;

            var union_start_handler = new unionTaskHandler();
            union_start_handler.start(msg, session, function (err, res) {
                console.log('res:', res);
                done();
            });
        });
    });

    suite('联盟任务秒时间', function () {
        test('联盟任务秒时间', function (done) {
            var msg = {};
            msg.task_id = config.union_task_id;
            var session = {};
            session.uid = config.role_id;

            var union_receive_handler = new unionTaskHandler();
            union_receive_handler.direct(msg, session, function (err, res) {
                console.log('res:', res);
                done();
            });
        });
    });

    suite('联盟任务领取', function () {
        test('联盟任务领取', function (done) {
            var msg = {};
            msg.task_id = config.union_task_id;
            var session = {};
            session.uid = config.role_id;

            var union_receive_handler = new unionTaskHandler();
            union_receive_handler.receive(msg, session, function (err, res) {
                console.log('res:', res);
                done();
            });
        });
    });

    // suite('联盟任务宝箱领取', function () {
    //     test('联盟任务宝箱领取', function (done) {
    //         var msg = {};
    //         msg.star = 100;
    //         var session = {};
    //         session.uid = config.role_id;

    //         var union_receive_handler = new unionTaskHandler();
    //         union_receive_handler.starBoxReceive(msg, session, function (err, res) {
    //             console.log('res:', res);
    //             done();
    //         });
    //     });
    // });

    // suite('联盟任务刷新', function () {
    //     test('联盟任务刷新', function (done) {
    //         var msg = {};
    //         var session = {};
    //         session.uid = config.role_id;

    //         var union_refresh_handler = new unionTaskHandler();
    //         union_refresh_handler.refresh(msg, session, function (err, res) {
    //             console.log('res:', res);
    //             done();
    //         });
    //     });
    // });
});
